/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author USER
 */
@Entity
@Table(name = "salon")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Salon.findAll", query = "SELECT s FROM Salon s"),
    @NamedQuery(name = "Salon.findByIdSalon", query = "SELECT s FROM Salon s WHERE s.idSalon = :idSalon"),
    @NamedQuery(name = "Salon.findByKapasite", query = "SELECT s FROM Salon s WHERE s.kapasite = :kapasite"),
    @NamedQuery(name = "Salon.findBySalonAdi", query = "SELECT s FROM Salon s WHERE s.salonAdi = :salonAdi")})
public class Salon implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idSalon")
    private Integer idSalon;
    @Basic(optional = false)
    @Column(name = "kapasite")
    private int kapasite;
    @Basic(optional = false)
    @Column(name = "salonAdi")
    private String salonAdi;
    @OneToMany(mappedBy = "salonId")
    private Collection<Koltuk> koltukCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "salonId")
    private Collection<Seans> seansCollection;

    public Salon() {
    }

    public Salon(Integer idSalon) {
        this.idSalon = idSalon;
    }

    public Salon(Integer idSalon, int kapasite, String salonAdi) {
        this.idSalon = idSalon;
        this.kapasite = kapasite;
        this.salonAdi = salonAdi;
    }

    public Integer getIdSalon() {
        return idSalon;
    }

    public void setIdSalon(Integer idSalon) {
        this.idSalon = idSalon;
    }

    public int getKapasite() {
        return kapasite;
    }

    public void setKapasite(int kapasite) {
        this.kapasite = kapasite;
    }

    public String getSalonAdi() {
        return salonAdi;
    }

    public void setSalonAdi(String salonAdi) {
        this.salonAdi = salonAdi;
    }

    @XmlTransient
    public Collection<Koltuk> getKoltukCollection() {
        return koltukCollection;
    }

    public void setKoltukCollection(Collection<Koltuk> koltukCollection) {
        this.koltukCollection = koltukCollection;
    }

    @XmlTransient
    public Collection<Seans> getSeansCollection() {
        return seansCollection;
    }

    public void setSeansCollection(Collection<Seans> seansCollection) {
        this.seansCollection = seansCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSalon != null ? idSalon.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Salon)) {
            return false;
        }
        Salon other = (Salon) object;
        if ((this.idSalon == null && other.idSalon != null) || (this.idSalon != null && !this.idSalon.equals(other.idSalon))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Salon[ idSalon=" + idSalon + " ]";
    }
    
}
